package com.group01.validation;

import com.group01.annotation.Flag2;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

/**
 * @Description
 * @Author 翟玉龙
 * @Date 2024/6/21
 */
public class Flag2Validation implements ConstraintValidator<Flag2, Integer> {


    @Override
    public boolean isValid(Integer value, ConstraintValidatorContext context) {
        if(value == null) {
            return false;
        }
        return value.equals(0) || value.equals(1); // 01 校验
    }
}

